package com.itheima.a01mymap;

import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;

public class A04_MapDemo4 {
    public static void main(String[] args) {
        //创建结合
        Map<String, String> map = new HashMap<>();

        //添加对象
        map.put("刘备", "接着奏乐接着舞");
        map.put("曹操", "宁教我负天下人");

        //输出打印
        map.forEach(new BiConsumer<String, String>() {
            @Override
            public void accept(String key, String value) {
                System.out.println(key + "--" + value);
            }
        });

        System.out.println("--------------------");
        map.forEach((key, value) -> System.out.println(key + "--" + value));
    }
}
